package com.primi.chen.zookeeper;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.nio.charset.StandardCharsets;

/**
 * Create AT 2019/12/25 14:41:14:41
 *
 * @author Primi.Chen(Chenxiangxu)
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ServiceConfiguration extends NodeInfo {
    private String name;
    private String zkservers;
    private Integer sessionTimeout = 10000;
    private String version = "1.0.0";

    public byte[] data() {
        return version.getBytes(StandardCharsets.UTF_8);
    }

    public String filename() {
        return String.format("/%s/%s:%s_", name, this.getHost(), this.getPort());
    }

}
